package com.imti.controller;


import com.github.pagehelper.PageHelper;
import com.imti.Api.CommonResult;
import com.imti.entity.NoticeInfo;
import com.imti.service.NoticeInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (NoticeInfo)表控制层
 *
 * @author makejava
 * @since 2023-02-01 13:17:55
 */
@RestController
@RequestMapping("noticeInfo")
public class NoticeInfoController {
    /**
     * 服务对象
     */
    @Resource
    private NoticeInfoService noticeInfoService;


    @GetMapping
    public CommonResult<List<NoticeInfo>> selectAll(@RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
                                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
        PageHelper.startPage(pageNum, pageSize);
        return CommonResult.success(noticeInfoService.list());
    }

    @GetMapping("findNoticeById")
    public CommonResult<NoticeInfo> findNoticeById(Integer infoId){
        return CommonResult.success(noticeInfoService.findNoticeById(infoId));
    }

}

